Optimal. Leaf size=102 \[ -\frac {(3 A+i B) \cot (c+d x)}{2 a d}-\frac {(-B+i A) \log (\sin (c+d x))}{a d}+\frac {(A+i B) \cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {x (3 A+i B)}{2 a} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.17, antiderivative size = 102, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {3596, 3529, 3531, 3475} \[ -\frac {(3 A+i B) \cot (c+d x)}{2 a d}-\frac {(-B+i A) \log (\sin (c+d x))}{a d}+\frac {(A+i B) \cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {x (3 A+i B)}{2 a} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3529
Rule 3531
Rule 3596
Rubi steps
\begin {align*} \int \frac {\cot ^2(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx &=\frac {(A+i B) \cot (c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {\int \cot ^2(c+d x) (a (3 A+i B)-2 a (i A-B) \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac {(3 A+i B) \cot (c+d x)}{2 a d}+\frac {(A+i B) \cot (c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {\int \cot (c+d x) (-2 a (i A-B)-a (3 A+i B) \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac {(3 A+i B) x}{2 a}-\frac {(3 A+i B) \cot (c+d x)}{2 a d}+\frac {(A+i B) \cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {(i A-B) \int \cot (c+d x) \, dx}{a}\\ &=-\frac {(3 A+i B) x}{2 a}-\frac {(3 A+i B) \cot (c+d x)}{2 a d}-\frac {(i A-B) \log (\sin (c+d x))}{a d}+\frac {(A+i B) \cot (c+d x)}{2 d (a+i a \tan (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 3.17, size = 225, normalized size = 2.21 \[ \frac {(\cos (d x)+i \sin (d x)) (A+B \tan (c+d x)) \left (\frac {1}{2} (B-i A) (\cos (c)-i \sin (c)) \cos (2 d x)-\frac {1}{2} (A+i B) (\cos (c)-i \sin (c)) \sin (2 d x)+2 d x (A+i B) (\cos (c)+i \sin (c))-d x (3 A+i B) (\cos (c)+i \sin (c))+(B-i A) (\cos (c)+i \sin (c)) \log \left (\sin ^2(c+d x)\right )-2 (A+i B) (\cos (c)+i \sin (c)) \tan ^{-1}(\tan (d x))+2 A (\cot (c)+i) \sin (d x) \csc (c+d x)\right )}{2 d (a+i a \tan (c+d x)) (A \cos (c+d x)+B \sin (c+d x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.58, size = 131, normalized size = 1.28 \[ -\frac {2 \, {\left (5 \, A + 3 i \, B\right )} d x e^{\left (4 i \, d x + 4 i \, c\right )} - {\left (2 \, {\left (5 \, A + 3 i \, B\right )} d x - 9 i \, A + B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} - {\left ({\left (-4 i \, A + 4 \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (4 i \, A - 4 \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right ) - i \, A + B}{4 \, {\left (a d e^{\left (4 i \, d x + 4 i \, c\right )} - a d e^{\left (2 i \, d x + 2 i \, c\right )}\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.70, size = 135, normalized size = 1.32 \[ -\frac {\frac {2 \, {\left (-5 i \, A + 3 \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a} + \frac {2 \, {\left (i \, A + B\right )} \log \left (-i \, \tan \left (d x + c\right ) + 1\right )}{a} + \frac {8 \, {\left (i \, A - B\right )} \log \left (\tan \left (d x + c\right )\right )}{a} + \frac {A \tan \left (d x + c\right )^{2} - i \, B \tan \left (d x + c\right )^{2} - 13 i \, A \tan \left (d x + c\right ) + 3 \, B \tan \left (d x + c\right ) - 8 \, A}{{\left (-i \, \tan \left (d x + c\right )^{2} - \tan \left (d x + c\right )\right )} a}}{8 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.58, size = 170, normalized size = 1.67 \[ -\frac {B \ln \left (\tan \left (d x +c \right )+i\right )}{4 d a}-\frac {i A \ln \left (\tan \left (d x +c \right )+i\right )}{4 d a}-\frac {i A \ln \left (\tan \left (d x +c \right )\right )}{a d}+\frac {B \ln \left (\tan \left (d x +c \right )\right )}{a d}-\frac {A}{a d \tan \left (d x +c \right )}-\frac {A}{2 d a \left (\tan \left (d x +c \right )-i\right )}-\frac {i B}{2 d a \left (\tan \left (d x +c \right )-i\right )}+\frac {5 i \ln \left (\tan \left (d x +c \right )-i\right ) A}{4 d a}-\frac {3 \ln \left (\tan \left (d x +c \right )-i\right ) B}{4 d a} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.46, size = 126, normalized size = 1.24 \[ -\frac {\frac {A}{a}+\mathrm {tan}\left (c+d\,x\right )\,\left (-\frac {B}{2\,a}+\frac {A\,3{}\mathrm {i}}{2\,a}\right )}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^2\,1{}\mathrm {i}+\mathrm {tan}\left (c+d\,x\right )\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,\left (-B+A\,1{}\mathrm {i}\right )}{a\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )}{4\,a\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-3\,B+A\,5{}\mathrm {i}\right )}{4\,a\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.65, size = 160, normalized size = 1.57 \[ \frac {2 i A}{- a d e^{2 i c} e^{2 i d x} + a d} + \begin {cases} - \frac {\left (i A - B\right ) e^{- 2 i c} e^{- 2 i d x}}{4 a d} & \text {for}\: 4 a d e^{2 i c} \neq 0 \\x \left (- \frac {- 5 A - 3 i B}{2 a} + \frac {i \left (5 i A e^{2 i c} + i A - 3 B e^{2 i c} - B\right ) e^{- 2 i c}}{2 a}\right ) & \text {otherwise} \end {cases} - \frac {x \left (5 A + 3 i B\right )}{2 a} - \frac {i \left (A + i B\right ) \log {\left (e^{2 i d x} - e^{- 2 i c} \right )}}{a d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________